const App = getApp();
const navigationBarHeight = (getApp().diygwstatusBarHeight + 44) + 'px'
Page({
    data: {
        tabs1:[],
        activeIndex1:0,
        scrollLeft:0,
        caid: 0,
        msgs2: [],
        url: App.Config.basePath
    },

    showModal(message) {
        App.WxService.showModal({
            title: '友情提示',
            content: message,
            showCancel: !1,
        });
    },
    onShareAppMessage: function () {
    },
    onLoad(option) {
        if (option) {
            this.setData({
                globalOption: option
            })
        }
    },
    onShow() {
        this.getTabs1();
        this.getMsgs2(1);
    },
    navigateTo(e) {
        App.navigateTo(e.currentTarget.dataset.url, e.currentTarget.dataset);
    },

    getTabs1(page) {
        //调用数据
        App.HttpService.getData({
            f: 1
        }, "/category_List").then(data => {
            this.setData({

                tabsActiveIndex1: 0,
                tabs1: data
            });
        });
    },

    tabClick1: function (e) {
        const dataset = e.currentTarget.dataset;
        this.setData({
            activeIndex1: dataset.id,
            caid: this.data.tabs1[dataset.id].caid,
            scrollLeft: (e.currentTarget.dataset.id-1)*60
        });

        this.getMsgs2();
    },


    getMsgs2() {
        //调用数据
        let param = {
            f: 10,
            caid: this.data.caid,
            loadmsg: `正在加载中`
        };

        App.HttpService.getData(param, "/books_List").then(data => {
            this.setData({
                msgs2: data
            });
        });
    } ,




    diandi(e)
    {
        this.setData({
            keys: e.currentTarget.dataset.k
        })

        this.getMsgs2();
    },



})
